import axios from 'axios'

 export function request(config) {
  const instance1 = axios.create({
    baseURL: "http://127.0.0.1:8888/api/private/v1/",
    timeout: 5000
  })

  // 请求拦截
  instance1.interceptors.request.use(config => {
    config.headers.Authorization = window.sessionStorage.getItem('token')
    return config
  })
    

  // 响应拦截
  instance1.interceptors.response.use(
    result => {
      return result.data
    },
    err => {
      console.log(err);
    }
  )
  return instance1(config)
} 
//  封装GET请求
 function get(url,params,options){
  return request(url,params,options,'get')
}
export default {
  get
}
